﻿using Dotnet.Data;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sui.Domain.Repository
{
    public class SqlsRepository : RepositoryBase<SqlsEntity>, ISqlsRepository
    {
        public SqlsRepository(System.Data.Common.DbConnection conn) : base(conn)
        {

        }
        public override int Update(SqlsEntity entity)
        {
            ColsEntity localEntity = dbcontext.Set<ColsEntity>().Local.FirstOrDefault(t => t.id == entity.id);
            if (localEntity == null)
            {
                return base.Update(entity);
            }
            else
            {
                dbcontext.Entry<ColsEntity>(localEntity).State = EntityState.Detached;
                return base.Update(entity);
            }
        }
    }
}
